﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Emu8080.Compiler.Structures
{
    public class Module
    {
        public Dictionary<string, IProcessingUnitFundamental> Labels { get; private set; }
        public List<ProcessingUnit> ProcessingUnits { get; private set; }

        public Module()
        {
            Labels = new Dictionary<string, IProcessingUnitFundamental>();
            ProcessingUnits = new List<ProcessingUnit>();
        }

        public byte[] GetMachineCodes()
        {
            List<byte> list = new List<byte>();
            foreach (var item in ProcessingUnits)
            {
                if (item is IProcessingUnitFundamental)
                {
                    list.AddRange((item as IProcessingUnitFundamental).GetMachineCodes());
                }
            }
            return list.ToArray();
        }
    }
}
